{extend name="layout" /}

{block name="page-header"}{/block}

{block name="content"}


<div class="row">

    <div class="col-md-12">
        <div class="block">

            <div class="block-content tab-content">
                <div class="tab-pane active">
                    <div class="search-area border-b push">
                        <form action="{:url('company')}" class="form-horizontal row" name="form">
                            <div class="col-md-2 col-xs-12 push">
                                <div class="input-group">
                                    <span class="input-group-addon">输入日期</span>
                                    <input class="form-control" type="text" id="query_time" value="{$query_time}"
                                        name="query_time" placeholder="输入日期">
                                </div>
                            </div>

                            <div class="col-md-2 col-xs-12 push">
                                <div class="input-group">
                                    <span class="input-group-addon">查看方式</span>
                                    <select class="js-select2 form-control" id="type" name="query_type"
                                        data-width="resolve" data-allow-clear="true" data-placeholder="查看方式">

                                        <option value="week" {if condition="$query_type eq 'week'" } selected {/if}>一周
                                        </option>
                                        <option value="day" {if condition="$query_type eq  'day'" } selected {/if}>一天
                                        </option>

                                    </select>
                                </div>
                            </div>

                            <div class="col-md-2 col-xs-12 push">
                                <div class="input-group">
                                    <span class="input-group-addon">查看分类</span>
                                    <select class="js-select2 form-control" id="type" name="query_class"
                                        data-width="resolve" data-allow-clear="true" data-placeholder="查看方式">

                                        <option value="cash" {if condition="$query_class eq  'cash'" } selected {/if}>金额
                                        </option>
                                        <option value="count" {if condition="$query_class eq 'count'" } selected {/if}>
                                            笔数</option>

                                    </select>
                                </div>
                            </div>

                            <div class="col-md-2 col-xs-12 push">
                                <div class="input-group">
                                    <span class="input-group-addon">查看笔数</span>
                                    <select class="js-select2 form-control" id="type" name="query_status"
                                        data-width="resolve" data-allow-clear="true" data-placeholder="查看方式">

                                        <option value="total" {if condition="$query_status eq 'total'" } selected {/if}>
                                            创建笔数</option>
                                        <option value="complete" {if condition="$query_status eq  'complete'" } selected
                                            {/if}>完成笔数</option>

                                    </select>
                                </div>
                            </div>

                            <div class="col-md-2 col-xs-12 push">
                                <div class="input-group">
                                    <span class="input-group-addon">查看公司</span>
                                    <select class="js-select2 form-control" id="type" name="child_company"
                                        data-width="resolve" data-allow-clear="true" data-placeholder="查看方式">
                                        {foreach name="all_child_company" item="vo" key="k" }
                                        <option value="{$k}" {if condition="$child_company eq $k" } selected {/if}>
                                            {$vo} </option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>

                            <div class="col-md-1 col-xs-12 push">
                                <div class="form-group">
                                    <div class="col-md-12">
                                        <button class="btn btn-sm btn-primary" type="submit"><i
                                                class="fa fa-search"></i> 搜索</button>
                                    </div>
                                </div>
                            </div>

                        </form>
                    </div>

                    <div class="row data-table-toolbar">
                        <div class="col-sm-12">

                            <div class="toolbar-btn-action">
                                <a title="交易统计" id="date_create_time" class="btn btn-nm btn-default">{$query_time}
                                    交易统计</a>
                            </div>

                        </div>
                    </div>

                    <div class="table-responsive">
                        <table class="table table-builder table-hover table-bordered table-striped js-table-checkable">
                            <thead>
                                <tr>

                                    <th class="column">
                                        <span>
                                            支付类型
                                        </span>
                                    </th>
                                    <th class="column">
                                        <span>
                                            创建笔数
                                        </span>
                                    </th>
                                    <th class="column">
                                        <span>
                                            完成笔数
                                        </span>
                                    </th>
                                    <th class="column">
                                        <span>
                                            创建金额(元)
                                        </span>
                                    </th>
                                    <th class="column">
                                        <span>
                                            完成金额(元)
                                        </span>
                                    </th>
                                    <th class="column">
                                        <span>
                                            笔数转换率
                                        </span>
                                    </th>
                                    <th class="column">
                                        <span>
                                            订单金额转换率
                                        </span>
                                    </th>

                                </tr>
                            </thead>
                            <tbody>
                                {foreach name="now_data" item="vo" key="k" }

                                <tr class="">

                                    <td class="">
                                        {$all_payment_type[$k]}
                                    </td>
                                    <td class="">
                                        {$vo['now_order_count_sum']}
                                    </td>
                                    <td class="">
                                        {$vo['now_order_count_ok']}
                                    </td>
                                    <td class="">
                                        {$vo['now_order_cash_sum']}
                                    </td>
                                    <td class="">
                                        {$vo['now_order_cash_ok']}
                                    </td>
                                    <td class="">
                                        {neq name="$vo['now_order_count_sum']" value="0"}
                                        {:round($vo['now_order_count_ok']*100/$vo['now_order_count_sum'],2)}%
                                        {else/}
                                        0%
                                        {/neq}
                                    </td>
                                    <td class="">
                                        {neq name="$vo['now_order_cash_sum']" value="0"}
                                        {:round($vo['now_order_cash_ok']*100/$vo['now_order_cash_sum'],2)}%
                                        {else/}
                                        0%
                                        {/neq}
                                    </td>

                                </tr>
                                {/foreach}

                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
    <div class="toolbar-btn-action" style="float: right">
        <a class="btn btn-xs btn-default" href="{$url}chart=1"> 图一</a>
        <a class="btn btn-xs btn-default" href="{$url}chart=2"> 图二</a>
        <a class="btn btn-xs btn-default" href="{$url}chart=3"> 图三</a>
        <a class="btn btn-xs btn-default" href="{$url}chart=4"> 图四</a>
    </div>
</div>
<script src="__LIBS__/laydate/laydate.js"></script>
<script>
    var day = new Date();
    day.setTime(day.getTime());
    var time = day.getFullYear() + "-" + (day.getMonth() + 1) + "-" + day.getDate();
    //执行一个laydate实例
    laydate.render({
        elem: '#query_time', //指定元素
        max: time
    });</script>

<div id="container" style="height: 455px;"></div>
<script type="text/javascript" src="__LIBS__/echarts/echarts.min.js"></script>
<script type="text/javascript" src="__LIBS__/echarts/echarts-gl.min.js"></script>
<script type="text/javascript" src="__LIBS__/echarts/ecStat.min.js"></script>
<script type="text/javascript" src="__LIBS__/echarts/dataTool.min.js"></script>
<script type="text/javascript" src="__LIBS__/echarts/china.js"></script>
<script type="text/javascript" src="__LIBS__/echarts/world.js"></script>
<script type="text/javascript" src="__LIBS__/echarts/bmap.min.js"></script>
<script type="text/javascript" src="__LIBS__/echarts/simplex.js"></script>
<script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var app = {};
    option = null;
    option = {
        title: {
            text: '{$title}'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        legend: {
            data: { $type_name }
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                boundaryGap: true,
                data: { $all_date }
            }
        ],
        yAxis: [
            {
                type: 'value'
            }
        ],
        series: { $series }
    };
    ;
    if (option && typeof option === "object") {
        myChart.setOption(option, true);
    }
</script>

{/block}

{block name="script"}

{/block}